<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <f:view>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
            <t:stylesheet path="/stylesheet.css" />
        </head>
        <body>
            <h2>Planning des reservations</h2>
            <h:form>
                <dl>
                    <dt>Hotel : </dt>
                    <dd><h:selectOneMenu value="#{PlanningBean.hotel}" converter="HotelConverter" >
                            <f:selectItems value="#{PlanningBean.hotelItems}"/>
                        </h:selectOneMenu>
                        
                    </dd>
                </dl>
                <dl>
                    <dt>Choisir le mois du planning : </dt>
                    <dd><t:inputDate popupCalendar="true"  value="#{PlanningBean.dateDebut}"/>
                    </dd>
                </dl>
                
                <h:commandButton value="Rechercher les reservations" />
                
                <h:outputText value="Aucune reservation !" rendered="#{empty PlanningBean.hotel.chambreCollection}" />
                
                <h:panelGroup rendered="#{not empty PlanningBean.hotel.chambreCollection}">
                    <table  class="planning">
                        <caption>Reservations pour l'hotel (<h:outputText value="#{PlanningBean.hotel.nom} #{PlanningBean.dateDebut.month+1}/#{PlanningBean.dateDebut.year+1900}"/>) </caption>
                        <t:dataList value="#{PlanningBean.chambres}" rowIndexVar="nbRow" var="chambre" layout="simple">
                            <h:panelGroup rendered="#{nbRow==0}">
                                <tr>
                                    <th>Chambre</th>
                                    <t:dataList var="jour" value="#{chambre.jours}"  rowIndexVar="nbRowC"  layout="simple">
                                    
                                        <th><h:outputText  value="#{nbRowC+1}" /></th>
                                        
                                    </t:dataList> 
                                </tr>
                            </h:panelGroup>
                            <tr>
                                <th><h:outputText value="#{chambre.chambre.nom}"/></th>
                                
                                <t:dataList var="jour" value="#{chambre.jours}" rowIndexVar="nbRowC" layout="simple">
                                
                                    <td>
                                        <h:panelGroup rendered="#{jour}">
                                            <h:commandLink value="&nbsp;"  styleClass="oqp">
                                                <f:attribute name="jour" value="#{nbRowC+1}" />
                                                <f:attribute name="chambre" value="#{chambre.chambre}" />
                                            </h:commandLink>
                                        </h:panelGroup>
                                        
                                    </td>
                                    
                                </t:dataList> 
                            </tr>
                            
                            
                            
                            
                            
                        </t:dataList>
                    </table>
                </h:panelGroup>
                
                
                <%--
                <t:dataList value="#{PlanningBean.hotel.chambreCollection}" var="chambre" layout="unordered">
                    
                    <h:outputText value="#{chambre.nom}" />
                    
                    <t:dataTable value="#{chambre.reservationCollection}" var="reservation">                       
                        <h:column>
                            <f:facet name="header">
                                <f:verbatim>Date de debut</f:verbatim>
                            </f:facet>
                            <h:outputText value="#{reservation.dateEntree}" />
                            
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <f:verbatim>Date de fin</f:verbatim>
                            </f:facet>
                            <h:outputText value="#{reservation.dateSortie}" />
                            
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <f:verbatim>Nom du client</f:verbatim>
                            </f:facet>
                            <h:outputText value="#{reservation.client.nom}" />
                            
                        </h:column>                            
                        
                    </t:dataTable>
                    
                </t:dataList>
                
                <h:selectOneMenu value="#{PlanningBean.moisEnCours}">
                    <f:selectItems value="#{PlanningBean.listeMois}"/>
                </h:selectOneMenu>
                
                <h:commandButton action="#{PlanningBean.action}" value="ok"/>
                <h:outputText value="#{PlanningBean.hotel}" />
                
               
               <h:dataTable border="1" value="#{PlanningBean.hotel.chambreCollection}" rows="#{PlanningBean.nbrJours}" var="c">
                    
                    <h:column>
                        <f:facet name="header">
                            <f:verbatim>nom</f:verbatim>
                        </f:facet>
                        <h:outputText value="#{c.nom}" />
                        
                    </h:column>
                    
                    
                  
                </h:dataTable>

                --%>
            </h:form>
            
            
        </body>
    </f:view>
</html>
